package com.xindacloud.sms.console.system.service.impl;

import com.xindacloud.sms.console.result.Result;
import com.xindacloud.sms.console.result.ResultGenerator;
import com.xindacloud.sms.console.system.dto.SmsDeliveryReceiptDTO;
import com.xindacloud.sms.console.system.entity.SmsAgent;
import com.xindacloud.sms.console.system.entity.SmsDeliveryReceipt;
import com.xindacloud.sms.console.system.mapper.SmsDeliveryReceiptMapper;
import com.xindacloud.sms.console.system.service.ISmsDeliveryReceiptService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 消息明细 服务实现类
 * </p>
 *
 * @author czc
 * @since 2019-10-08
 */
@Service
public class SmsDeliveryReceiptServiceImpl extends ServiceImpl<SmsDeliveryReceiptMapper, SmsDeliveryReceipt> implements ISmsDeliveryReceiptService {

	@Override
	public Result getSmsReceiptList(SmsDeliveryReceiptDTO smsDeliveryReceiptDTO) {
		IPage<SmsDeliveryReceipt> page=new Page<>(smsDeliveryReceiptDTO.getPageNum(),smsDeliveryReceiptDTO.getPageSize());
		QueryWrapper<SmsDeliveryReceipt> queryWrapper=new QueryWrapper<>();
		if(smsDeliveryReceiptDTO.getSendFrom()!=null) {
		queryWrapper.eq("sent_from", smsDeliveryReceiptDTO.getSendFrom());
		}
		return ResultGenerator.genSuccessResult(this.page(page,queryWrapper));
	}

}
